package com.youngwang.http;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.web.client.RestTemplate;

/**
 * RestTemplate 工具类
 * @author youngwang
 *         Date: 2016/9/28
 */
public class RestTemplateUtils {

    private static final RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder();

    public static RestTemplate getRestTemplate() {
        return getRestTemplateBuilder().build();
    }

    public static RestTemplateBuilder getRestTemplateBuilder() {
        if (null == restTemplateBuilder)
            return new RestTemplateBuilder();
        else
            return restTemplateBuilder;
    }
}
